function topTheDuan(id) {
    duanPage.top(id, function(data) {
        if (data) {
            alert(1);
        } else {
            alert(2);
        }
    });
}

function downTheDuan(id) {
    duanPage.down(id, function(data) {
        if (data) {
            alert(1);
        } else {
            alert(2);
        }
    });
}


$(document).ready(function() {
    var content = $("div[id=b] > div[id=content] > div[id=list]");
    content.hide();
    var type = getParamValue("type");
    duanPage.findByType(type,function(data) {
            if (data.length > 0) {
                var needInsertHtml = "";
                for ( var i = 0; i < data.length; i++) {
                    var html = "<div class='main_list'><div>&nbsp;&nbsp;&nbsp;&nbsp;"
                            + data[i].content
                            + "</div><div class='info'><div class='mutual'><a onclick='topTheDuan("+data[i].id+");'>顶(1212)</a><a onclick='downTheDuan("+data[i].id+");'>踩(1)</a></div><div class='author'> By : "
                            + data[i].author + "</div></div></div>";
                    needInsertHtml += html;
                }
                content.html(needInsertHtml);
            }
        });
    content.show();
});